<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;" name="viewport" />
    <title>骆米智慧校园</title>
    <link rel="stylesheet" href="css/inquire.css?v=0401628700430392">
    <script src="js/rem.js?v=0401628700430392"></script>
    <script src="js/jquery.min.js?v=0401628700430392"></script>
    <script type="text/javascript" src="http://res2.wx.qq.com/open/js/jweixin-1.4.0.js?v=0401628700430392"></script>
    <script src="js/layer/mobile/layer.js?v=0401628700430392"></script>
</head>
<body>
    <div class="container">
        <div class="inqr-tt">合作咨询请留言</div>
        <textarea id="submitContent" class="inqr-desc" placeholder="请输入您的留言内容，我们会及时和您联系"></textarea>

        <div class="pn-p">
            <div class="pn-tr">
                <img class="pn-img" src="img/14-1.png?v=0401628700430392" alt="">
                <input id="submitName" class="pn-input" type="text" placeholder="请输入您的姓名">
            </div>
            <div class="pn-line"></div>
            <div class="pn-tr">
                <img class="pn-img" src="img/14-2.png?v=0401628700430392" alt="">
                <input id="submitPhone" class="pn-input" type="text" placeholder="请输入您的电话">
            </div>
        </div>
        <div id="submitBtn" class="submit-btn">提交</div>
    </div>
</body>
</html>
<script src="js/wxConfig.js?v=0401628700430392"></script>
<script>
   
    $('#submitBtn').click(function(){
        var submitName = $.trim($('#submitName').val())
        var submitPhone = $.trim($('#submitPhone').val())
        var submitContent = $.trim($('#submitContent').val())
        if (!submitContent) {
           
           layer.open({
               content: '请填写留言'
               ,skin: 'msg'
               ,time: 2 
           });
           return
       }
        if (!submitName) {
           
            layer.open({
                content: '请填写姓名'
                ,skin: 'msg'
                ,time: 2 
            });
            return
        }
        if (!submitPhone) {
          
            layer.open({
                content: '请填写电话'
                ,skin: 'msg'
                ,time: 2 
            });
            return
        }
        if(!(/^1[3456789]\d{9}$/.test(submitPhone))){ 
         
            layer.open({
                content: '您的电话号码填写有误'
                ,skin: 'msg'
                ,time: 2 
            });
            return 
        } 

        var params = {
            "title": submitContent,
            "phone": submitPhone,
            "userName": submitName
          }
        $.ajax({
            type: "POST",
            url: 'http://tapp.xueerqin.net/school/api/website/leaveComments',
            contentType: "application/json; charset=utf-8",
            data: JSON.stringify(params),
            success: function (resp) {
              
                layer.open({
                    content: '已成功提交预约'
                    ,btn: '我知道了'
                });
            },
            error: function (err) {
                
            }
        })
    })

</script>